<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;

class Video extends Base
{
    use SoftDeletes;

    protected $hidden = ['updated_at', 'deleted_at'];

    /**
     * 视频分类（多对多关系）
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function tags() {
        return $this->belongsToMany(Tag::class, 'video_tag')->using(VideoTag::class);
    }
    
    /**
     * 文件夹（一对一关系）
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function folder() {
        return $this->belongsTo(Folder::class);
    }
}
